package com.datang.springcode.beanCallBack;

import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
//此处标记类需要被扫描
@Component
public class House implements InitializingBean, DisposableBean {

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("接口形式的回调after");
    }

    @Override
    public void destroy() throws Exception {
        System.out.println("接口形式的回调destroy");
    }

    public House() {
        System.out.println("house的构造函数");
    }

    public void xmlInit() {
        System.out.println("xml形式初始化回调");
    }

    public void xmlDes() {
        System.out.println("xml形式销毁回调");
    }

    @PostConstruct
    public void annInit() {
        System.out.println("注解形式的初始化回调");
    }

    @PreDestroy
    public void annDes() {
        System.out.println("注解形式的销毁回调");
    }




}
